home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
32
/
dui.zip
/
DUI.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-02-16
|
10KB
|
276 lines
{$I Graph.P}
{$I Keyboard.Inc}
type PicType=Array[1..100] of Char;
MapType=Array[1..16,1..16] of char;
Var Car:Array[1..16] of String[16];
CarN,CarNE,CarE,CarSE,CarS,CarSW,CarW,CarNW:PicType;
C:Char;
Dead, X,Y, I,T, Dir:integer;
Peds:Array[1..10,1..4] of Integer;
CONST Pat:Array [0..7] of byte = ($FF,$FF,$FF,$FF, $FF,$FF,$FF,$FF);
Car1 : MapType =
(' ',
' 11 ',
' 1111 ',
' 2 1111 2 ',
' 21111112 ',
' 2 1111 2 ',
' 1111 ',
' 1111 ',
' 111111 ',
' 111111 ',
' 22 111111 22 ',
' 221111111122 ',
' 22 111111 22 ',
' 111111 ',
' 1111 ',
' ');
Car2 : MapType =
(' ',
' 2 11 ',
' 2 1111 ',
' 2 11111 ',
' 11111 ',
' 2 11111 ',
' 22 111111 2 ',
' 22 111111 2 ',
' 2 1111111 2 ',
' 111111 ',
' 1111111 ',
' 1111111 ',
' 1111111 22 ',
' 11111 22 ',
' 111 22 ',
' ');
Procedure ProcessU(CarMap:MapType; Var Pic:PicType);
var x,y:integer;
Begin
FillScreen(0);
For Y:= 1 to 16 do
For x:=1 to 16 do
Case CarMap[y,x] of
'1':Plot(x,y,1);
'2':Plot(X,y,2);
'3':Plot(x,y,3);
End;
getpic(pic, 1,1, 16,16);
End;
Procedure ProcessD(CarMap:MapType; Var Pic:PicType);
var x,y:integer;
Begin
FillScreen(0);
For Y:= 1 to 16 do
For x:=1 to 16 do
Case CarMap[17-y,x] of
'1':Plot(x,y,1);
'2':Plot(X,y,2);
'3':Plot(x,y,3);
End;
getpic(pic, 1,1, 16,16);
End;
Procedure ProcessL(CarMap:MapType; Var Pic:PicType);
var x,y:integer;
Begin
FillScreen(0);
For Y:= 1 to 16 do
For x:=1 to 16 do
Case CarMap[x,y] of
'1':Plot(x,y,1);
'2':Plot(X,y,2);
'3':Plot(x,y,3);
End;
getpic(pic, 1,1, 16,16);
End;
Procedure ProcessR(CarMap:MapType; Var Pic:PicType);
var x,y:integer;
Begin
FillScreen(0);
For Y:= 1 to 16 do
For x:=1 to 16 do
Case CarMap[17-x,17-y] of
'1':Plot(x,y,1);
'2':Plot(X,y,2);
'3':Plot(x,y,3);
End;
getpic(pic, 1,1, 16,16);
End;
Procedure ProcessX(CarMap:MapType; Var Pic:PicType);
var x,y:integer;
Begin
FillScreen(0);
For Y:= 1 to 16 do
For x:=1 to 16 do
Case CarMap[x,17-y] of
'1':Plot(x,y,1);
'2':Plot(X,y,2);
'3':Plot(x,y,3);
End;
getpic(pic, 1,1, 16,16);
End;
Procedure Incr(X:integer);
Begin X:=X+1 End;
Procedure Decr(X:integer);
Begin X:=X-1 End;
Begin
ClrScr;
GraphMode;
Palette(1);
ProcessU(Car1,CarN);
ProcessU(Car2,CarNE);
ProcessR(Car1,CarE);
ProcessD(Car2,CarSE);
ProcessD(Car1,CarS);
ProcessL(Car2,CarSW);
ProcessL(Car1,CarW);
ProcessX(Car2,CarNW);
TextMode(C40);
TextColor(9);
Writeln(' ██████████ ██ ██ ████████ ');
Writeln(' ██ ██ ██ ██ ██ ');
Writeln(' ██ ██ ██ ██ ██ ');
Writeln(' ██ ██ ██ ██ ██ ');
Writeln(' ██ ██ ██ ██ ██ ');
Writeln(' ██ ██ ██ ██ ██ ');
Writeln(' ██ ██ ██ ██ ██ ');
Writeln(' ██████████ ████████ ████████ ');
TextColor(12);
Writeln;
Writeln(' ... A non-violent alternative to ');
Writeln(' drinking and driving - by MVT-SOFT ');
Writeln;
Writeln(' The object is to run down all ten ');
Writeln(' pedestrians. Steer your car with ');
Writeln(' the left and right arrow keys; the ');
Writeln(' "5" key will turn the car around. ');
Writeln(' Press ESC to quit. If you can''t ');
Writeln(' catch the pedestrians, you should ');
Writeln(' not attempt to drive a real car! ');
Writeln;
Write (' Press any key to start..........');
Repeat Until Keypressed;
While keypressed do
read(KBD,c);
GraphMode;
FillScreen(0);
Palette(1);
Draw(0,8, 319,8, 3);
Draw(0,199, 319,199, 3);
Draw(0,8, 0,199, 3);
Draw(319,8, 319,199, 3);
GotoXY(1,1);
Write('MVT-Soft D.U.I.');
For I := 1 to 10 do
Begin
X := Random(300)+10;
Y := Random(170)+20;
Peds[I,1] := X;
Peds[I,2] := Y;
Peds[I,3] := Random(3)-1;
Peds[I,4] := Random(3)-1;
Plot(X,Y, 3);
end;
Dir := 1;
X := 160;
Y := 180;
C := ' ';
KeySet(NumLok,True);
Dead := 0;
Repeat
For I := 1 to 10 do
If (Peds[I,1]>=X) and (Peds[I,1]<=X+15) and
(Peds[I,2]<=Y) and (Peds[I,2]>=Y-15)
Then Begin { --- He's hit --- }
Sound(1500);
Delay(50);
NoSound;
Peds[I,1] := 0; Peds[I,2] := 0;
Dead := Dead+1;
GotoXY(29,1); Write('Deaths: ',Dead:2);
End
Else If Peds[I,1]<>0 { --- Else, If he's not already dead --- }
Then Begin
If (0=Random(50)) or
(30>Abs(7+X-Peds[I,1])+Abs((Y-7)-Peds[I,2]))
Then Repeat
Case Random(2) of
0:Begin
If Peds[I,1]<X
Then Peds[I,3]:=Random(4)-2
Else Peds[I,3]:=Random(4)-1;
If Peds[I,3]=-2 then Peds[I,3]:=-1;
If Peds[I,3]= 2 then Peds[I,3]:= 1;
End;
1:Begin
If Peds[I,2]<Y
Then Peds[I,4]:=Random(4)-2
Else Peds[I,4]:=Random(4)-1;
If Peds[I,4]=-2 then Peds[I,4]:=-1;
If Peds[I,4]= 2 then Peds[I,4]:= 1;
End;
End;
Until (Peds[I,3]<>0) or (Peds[I,4]<>0);
Plot(Peds[I,1],Peds[I,2], 0);
Peds[I,1] := Peds[I,1]+Peds[I,3];
Peds[I,2] := Peds[I,2]+Peds[I,4];
If Peds[I,1]<5 Then Peds[I,1] := 315;
If Peds[I,1]>315 Then Peds[I,1] := 5;
If Peds[I,2]<15 Then Peds[I,2] := 195;
If Peds[I,2]>195 Then Peds[I,2] := 15;
Plot(Peds[I,1],Peds[I,2], 3);
End;
Case Dir of
1:Begin Y:=Y-1; PutPic(CarN, X,Y) End;
2:Begin Y:=Y-1; X:=X+1; PutPic(CarNE,X,Y) End;
3:Begin X:=X+1; PutPic(CarE ,X,Y) End;
4:Begin Y:=Y+1; X:=X+1; PutPic(CarSE,X,Y) End;
5:Begin Y:=Y+1; PutPic(CarS ,X,Y) End;
6:Begin Y:=Y+1; X:=X-1; PutPic(CarSW,X,Y) End;
7:Begin X:=X-1; PutPic(CarW ,X,Y) End;
8:Begin Y:=Y-1; X:=X-1; PutPic(CarNW,X,Y) End;
End; {case}
If KeyPressed
Then Begin
Read(KBD,c);
Case C of
'4':dir:=Dir-1;
'5':dir:=Dir+4;
'6':dir:=Dir+1;
End;
End;
If X>=303 then Dir := Dir+4;
if X<=1 then Dir := Dir+4;
If Y<=24 then Dir := Dir+4;
If Y>=198 then Dir := Dir+4;
If Dir<1 Then Dir:=Dir+8;
If dir>8 Then Dir:=Dir-8;
If KeyChk(ScrLok) Then Delay(300);
until (C=#27) or (Dead=10);
For I := 200 to 1000 do
Begin
Sound(I);
Delay(1);
End;
For I := 1000 downto 10 do
Begin
Sound(I);
Delay(1);
End;
NoSound;
TextMode;
Writeln;
Writeln(' Drunk driving is just murder on our roads!');
KeySet(NumLok,False);
End.